# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-autobahn
_pkgname=autobahn
pkgver=19.11.1
pkgrel=3
pkgdesc='Real-time framework for Web, Mobile & Internet of Things.'
arch=('any')
url='https://crossbar.io/autobahn/'
license=('MIT')
depends=('python2-twistedx' 'python2-six' 'python2-txaio' 'python2-wsaccel')
makedepends=('python2-setuptools' 'python2-argon2_cffi' 'python2-msgpack'
             'python2-passlib' 'python2-pynacl')
optdepends=(
  'python2-msgpack: MsgPack serializer support'
  'python2-argon2_cffi: WAMP-SCRAM authentication support'
  'python2-passlib: WAMP-SCRAM authentication support'
  'python2-pynacl: WAMP-cryptosign support'
)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
        'skip-test-missing-serializers.patch')
sha512sums=('f5a986ff9d33c0cd20b5fa421d6bc823d4a6e5eb4c2ea65aeacf55005d2e6e1d55c554f407f172b9a27f45a7c6ed07b2efbc7f840040ff4dfaab2026a778c84a'
            '53f1845d1504be3c3d3e2183647f5758b5041e50954c22f4c4e25f4e330a35fbc901814870d29f4df74c277343fc873c8f81ae46f2daa9173695fd94ccd11c09')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -Np1 -i ../skip-test-missing-serializers.patch
}

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  for i in "$pkgdir/usr/bin/"*; do
    mv $i "${i}2"
  done
}

